package com.ai.dtcore.control;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.ai.dtcore.util.MyOwnRuntimeException;
import com.ai.frame.logger.Logger;
import com.ai.frame.logger.LoggerFactory;

public class DtCoreProvider {
	private static final Logger logger = LoggerFactory.getActionLog(DtCoreProvider.class);
    public static void main(String[] args) throws Exception {
        try {
            System.out.println("provider-of-smlcore开始注册!");
            String dubbo_cfg = System.getProperty("dubbo_cfg");
            System.out.println("dubbo_cfg=" + dubbo_cfg);
            if (dubbo_cfg == null || "".equals(dubbo_cfg)) {
                throw new MyOwnRuntimeException("请配置dubbo_cfg参数!");
            }
            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                new String[] { "spring/spring-all.xml", dubbo_cfg });
            context.start();
            System.out.println("provider-of-smlcore已注册!");
            synchronized (DtCoreProvider.class) {
                while (true) {
                    try {
                        DtCoreProvider.class.wait();
                    } catch (Exception e) {
                    	logger.error("","",e);
                    }
                }
            }
        } catch (Exception e) {
        	logger.error("","",e);
        }
    }

}
